package com.wanxi.spring.cloud.security.service;

import com.wanxi.spring.cloud.commons.api.CommonResult;
import com.wanxi.spring.cloud.security.model.User;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * <p>
 *  服务类
 * </p>
 *
 * @author 蒋帆
 * @since 2020-12-21
 */
public interface UserService {

    /**
     * 通过用户名查找用户
     * @param username
     * @return
     */
    CommonResult getUserByName(String username);

    /**
     * 登录
     * @param user
     * @return
     */
    CommonResult login(User user);

    CommonResult sendToken(String authHeader);

    void code(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException;

    CommonResult validateCode(String code,HttpServletRequest req);
}
